package com.zero.youxiao.dao;

import javax.inject.Inject;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.zero.basic.dao.DefaultBaseDao;
import com.zero.basic.dao.SqlQueryBaseDao;
import com.zero.basic.exception.SmsDaoException;
import com.zero.mms.model.SalaryCalItem;

@Repository("salaryCalItemDao")
@Transactional(rollbackFor= Exception.class)
public class SalaryCalItemDaoImpl extends DefaultBaseDao<SalaryCalItem>
		implements SalaryCalItemDao {

	@Inject
	private SqlQueryBaseDao<?> sqlQueryBaseDao;

	@Override
	public SalaryCalItem getByItemId(Integer itemId) throws SmsDaoException {
		try {
			String sql = "select s.* from t_cal_item s where s.item_id = ?";
			SalaryCalItem salaryCalItem = (SalaryCalItem) sqlQueryBaseDao.queryBySql(sql,
					itemId, SalaryCalItem.class, true, true);
			return salaryCalItem;
		} catch (Exception e) {
			throw new SmsDaoException();
		}
	}

}
